//定义入口文件
import Vue from 'vue'

//1.1导入路由的包
import VueRouter from 'vue-router'


//导入app
import App from './app.vue'



//引入mint-ui文件
import { Header,Swipe,SwipeItem,Button} from 'mint-ui'


//导入MUI文件
import './lib/mui/css/mui.css'
import './lib/mui/css/icons-extra.css'
//import mui from './lib/mui/js/mui.js'

//导入vue-resource
import VueResource from 'vue-resource'
//安装vue-resource
Vue.use(VueResource)
//定义默认的路径
Vue.http.options.root = './data';

//导入时间格式的包
import moment from 'moment'

//1.2 为vue注册router
Vue.use(VueRouter)


//1.3引入router文件
import router from './router.js'

//按需导入MInt-ui的包
Vue.component(Header.name, Header)
Vue.component(Swipe.name, Swipe);
Vue.component(SwipeItem.name, SwipeItem);
Vue.component(Button.name, Button);


//Vue.use(mui);
//定义一个全局的过滤器,用来过滤时间的
Vue.filter('timeFormat',function(dataStr,pentarn = ''){
	let date = new Date(dataStr);
	/* let y =date.getFullYear();
	let m = date.getMonth();
	let d = date.getDate();
	if(pentarn.toLowercase ==='yyyy-mm-dd'){
		return `${y}-${m}-${d}`;}else{
	let hh = date.getHours().toString().padStart(2,'0');
	let MM = date.getMinutes().toString().padStart(2,'0');
	let SS = date.getSeconds().toString().padStart(2,'0');
	return `${y}-${m}-${d}-${hh}:${MM}:${SS}`; */
	return moment(date).format('YYYY-MM-DD hh-mm-ss a');
	//}
})
let vm = new Vue({
	el:"#app",
	render:c=>c(App),
	router//1.4，挂载到vm实例对象里面
})